package threadDemo7;

import java.util.concurrent.FutureTask;

public class Demo {
    // 线程优先级：1-10
    public static void main(String[] args) {
        MyCallable mc = new MyCallable();
        MyCallable mc2 = new MyCallable();

        // FutureTask的泛型表示线程执行之后的数据类型
        FutureTask<String> ft = new FutureTask<>(mc);
        FutureTask<String> ft2 = new FutureTask<>(mc2);

        Thread t1 = new Thread(ft);
        t1.setName("飞机");
        t1.setPriority(10);
        Thread t2 = new Thread(ft2);
        t2.setName("坦克");
        t2.setPriority(1);

        // 打印默认优先级
        /*System.out.println(t1.getPriority()); // 5
        System.out.println(t2.getPriority()); // 5*/
        t1.start();
        t2.start();
    }
}
